<template>
  <div class="page_padding">
    <MyNavBar @goback="goback" :title="title" />
    <div class="tabs_box">
      <div class="tab_con">
        <!-- 内容列表 -->
        <div class="spot_con">
          <van-list
            v-model="loading"
            :finished="finished"
            finished-text="没有更多了"
            @load="pageSelfRecordSuggest"
            v-if="suggestDataList.length !== 0">
            <div class="spot_list" v-for="(item, index) in suggestDataList" :key="index" @click="goDetail(item)">
              <div class="spot_list_text">
                <span class="oragn_name">
                  {{ item.needDealName }}
                  <div class="readTip" v-if="item.isRead === '0'">
                    <img src="../../assets/images/appraise/unfinsh.png" alt="" />
                  </div>
                </span>
                <span class="createTime">{{ item.showStartTime.slice(0, 10) }}</span>
              </div>
            </div>
          </van-list>
          <van-empty v-if="suggestDataList.length == 0" description="暂无数据" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import MyNavBar from '@com/MyNavBar'
import { pageSelfRecordSuggest } from '@api/api-documentary.js'
export default {
  name: 'documentaryReply',
  props: {},
  data() {
    return {
      title: '纪实回复',
      suggestDataList: [],
      loading: false,
      finished: false,
      totalNum: '',
      currentPage: 1,
    }
  },
  computed: {},
  created() {},
  mounted() {
    this.pageSelfRecordSuggest()
  },
  watch: {},
  methods: {
    goback() {
      this.$router.go(-1)
    },
    pageSelfRecordSuggest() {
      let that = this
      let params = {
        current: that.currentPage,
        size: 10,
        optionUserId: localStorage.userId,
        tenantId: localStorage.tenantId,
      }
      pageSelfRecordSuggest(params).then(res => {
        if (res.code === 0) {
          that.totalNum = res.data.total
          that.suggestDataList.push(...res.data.records)
          that.currentPage++
          that.loading = false
          if (that.suggestDataList.length === that.totalNum) {
            that.finished = true
          }
        }
      })
    },
    // 时间切换
    timeChange() {
      this.currentPage = 1
      this.finished = false
      this.suggestDataList = []
      this.pageSelfRecordSuggest()
    },
    // 跳转建议详情
    goDetail(item) {
      const urlStr = item.url + '&isEnd=true'
      this.$router.push(urlStr)
    },
  },
  components: {
    MyNavBar,
  },
}
</script>

<style lang="scss" scoped>
.page_padding {
  .tabs_box {
    // position: fixed;
    top: 48px;
    left: 0;
    width: 100%;
    height: 40px;
    z-index: 10;
    /deep/.van-tabs--line .van-tabs__wrap {
      height: 40px;
      .my_tab {
        font-weight: bold;
      }
    }
  }
  .tab_con {
    // 时间切换
    .switch_title {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      height: 31px;
      padding: 5px 16px;
      background-color: #f4f6f8;
      position: relative;
      .category {
        // display: flex;
        // justify-content: flex-start;
        // align-items: center;
        color: #333333;
        font-size: 13px;
        // border: 1px solid #cccccc;
        margin: 0 5px;
        padding-right: 11px;
      }
      /deep/.van-dropdown-menu {
        .van-dropdown-menu__bar {
          height: 25px;
          background-color: transparent;
          box-shadow: none;
          .time_title {
            font-size: 13px;
            color: #333333;
          }
        }
        .van-popup--top {
          position: absolute;
        }
        .van-dropdown-item {
          position: absolute;
          top: 31px !important;
          height: 500px;
          width: 100%;
          .van-dropdown-item__content {
            // max-height: 50%;
          }
        }
      }
    }

    // 内容列表
    .spot_con {
      padding: 0 10px;
      .spot_list {
        position: relative;
        .spot_list_text {
          display: flex;
          justify-content: space-between;
          align-items: center;
          padding: 8px;
          font-size: 12px;
          color: #666;
          margin: 9px auto;
          border: 1px solid #ccc;
          border-radius: 4px;
          .oragn_name {
            margin-left: 5px;
            height: 25px;
            line-height: 25px;
            padding-right: 5px;
            display: flex;
            flex-direction: column;
            position: relative;
            @include ellipsis;
            .readTip {
              position: absolute;
              top: -7px;
              right: 0;
              width: 7px;
              height: 7px;
              img {
                width: 100%;
              }
            }
          }
          .createTime {
            margin-left: 5px;
            width: 80px;
            min-width: 80px;
          }
        }
      }
    }
  }
}
</style>
